<?php
/* @var $this DashboardController,
 * @var $requests ServiceRequest */

$this->breadcrumbs = array(
    'Dashboard',
);
?>
<div>
    <p>
    <h3>Your Appointments</h3>
    <?php
    if(isset($msg)){
        echo '<div styleName="error">'.$msg.'</div>';
    }
    if (isset($requests) && $requests) {
        echo '<table class="cmn_table"><tr><th>Service Name</th><th>Request On</th><th>Date Sheduled</th><th>Status</th></tr>';
        foreach ($requests as $key => $request) {
            echo '<tr>';
            echo '<td>' . $request->service->name . '</td><td>' . $request->requested_on .
            '</td><td>' . $request->event->starttime . '</td><td><span style="display:block;float:left;margin-left:20px;">' . $request->status.'</span>';
            if ($request->status == ServiceRequest::STATUS_SHEDULED) {
                echo '<a style="display:block;float:left;margin-left:20px;" href="' . Yii::app()->createUrl('booking/cancel') . '?request=' . $request->id . '">Cancel</a>';
            }
            echo ' </td>';
            echo '</tr>';
        }
        echo '</table>';
        $this->widget('CLinkPager', array(
            'pages' => $pages,
        ));
    }
    ?>
</p>
</div>
